﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using System.Web.Routing;
using System.Diagnostics;

namespace VQWEB
{
    public class Global : System.Web.HttpApplication
    {
        public static IHttpModule Module = new VQWEB.common.SecurityHttpmodule();
        public override void Init()
        {
            base.Init();
            //Module.Init(this);
        }

        protected void Application_Start(object sender, EventArgs e)
        {

            RegisterRoutes(RouteTable.Routes);            
        }

        public static void RegisterRoutes(RouteCollection routes)
        {

            //routes.Ignore("{resource}.axd/{*pathInfo}");    
            ///////////////////////CLIENT////////////////////

            //routes.MapPageRoute("Client_Demo",
            //   "client/{locale}/{year}/{category}",
            //   "~/administrator/index.aspx");

            //RouteValueDictionary parameters = new RouteValueDictionary  
            //{ 
            //    {"locale", "CA" }, 
            //    { "year", "2008" } , 
            //    { "category", "recreation" }
            //};

            //VirtualPathData vpd = RouteTable.Routes.GetVirtualPath(null, "Client_Demo", parameters);
            //Response.Write(vpd.VirtualPath);

            VQWEB.common.ReadXML.Routing(routes);
            VQWEB.huongnghiep.BL.ReadXML.Routing(routes);
            //////ADMINISTRATOR/////////////////////////
            routes.Add("Admin_Index_Handler", new Route("admin/index/handler", new VQWEB.administrator.handlers.IndexsHandler()));
            //Configs
            routes.Add("Admin_Configs_Handler", new Route("admin/configs/handler", new VQWEB.administrator.handlers.core_ConfigHandler()));
            //Advertisements            
            routes.Add("Admin_Advertisements_Handler", new Route("admin/advertisement/handler", new VQWEB.administrator.handlers.core_AdvertisementsHandler()));

            routes.Add("Admin_Event_Handler", new Route("admin/event/handler", new VQWEB.administrator.handlers.core_EventHandler()));
            routes.Add("Admin_Contact_Handler", new Route("admin/contact/handler", new VQWEB.administrator.handlers.core_ContactHandler()));

            //Users & Roles
            routes.Add("Admin_Membership_Handler", new Route("admin/membership/handler", new VQWEB.administrator.handlers.core_MembershipHandler()));
           
            //Files
            routes.Add("Admin_Files_Handler", new Route("admin/files/handler", new VQWEB.administrator.handlers.UploadsHandler()));
            
            //Group         
            routes.Add("Admin_News_Handler", new Route("admin/news/handler", new VQWEB.administrator.handlers.core_NewsHandler()));
            routes.Add("Admin_Product_Handler", new Route("admin/product/handler", new VQWEB.administrator.handlers.core_ProductHandler()));
            routes.Add("Admin_Intro_Handler", new Route("admin/introduction/handler", new VQWEB.administrator.handlers.core_IntroductionHandler()));
            
            //Tag & Category       
            routes.Add("Admin_Category_Handler", new Route("admin/category/handler", new VQWEB.administrator.handlers.core_CategoryHandler()));
            routes.Add("Admin_Tag_Handler", new Route("admin/tag/handler", new VQWEB.administrator.handlers.core_TagHandler()));
        
           
            //English Online         
            routes.Add("Admin_English_Course_Handler", new Route("admin/english/course/handler", new VQWEB.administrator.handlers.eng_CourseHandler()));
            routes.Add("Admin_English_Test_Handler", new Route("admin/english/test/handler", new VQWEB.administrator.handlers.eng_TestHandler()));
            routes.Add("Admin_English_Practice_Handler", new Route("admin/english/practice/handler", new VQWEB.administrator.handlers.eng_PracticeHandler()));
            routes.Add("Admin_English_Lecture_Handler", new Route("admin/english/lecture/handler", new VQWEB.administrator.handlers.eng_LectureHandler()));
            routes.Add("Admin_English_Excercise_Handler", new Route("admin/english/excercise/handler", new VQWEB.administrator.handlers.eng_ExcerciseHandler()));
            routes.Add("Admin_English_Classroom_Handler", new Route("admin/english/classroom/handler", new VQWEB.administrator.handlers.eng_ClassroomHandler()));
            routes.Add("Admin_English_Tabletime_Handler", new Route("admin/english/tabletime/handler", new VQWEB.administrator.handlers.eng_TabletimeHandler()));
            routes.Add("Admin_Schedule_Handler", new Route("admin/english/schedule/handler", new VQWEB.administrator.handlers.eng_ScheduleHandler()));
            //Huong Nghiep
            routes.Add("Admin_Nhomnganh_Handler", new Route("admin/huongnghiep/nhomnganh/handler", new VQWEB.administrator.handlers.hn_NganhHandler()));
            routes.Add("Admin_Truong_Handler", new Route("admin/huongnghiep/truong/handler", new VQWEB.administrator.handlers.hn_TruongHandler()));
            routes.Add("Admin_Khoi_Handler", new Route("admin/huongnghiep/khoi/handler", new VQWEB.administrator.handlers.hn_KhoiHandler()));
            routes.Add("Admin_Hedaotao_Handler", new Route("admin/huongnghiep/hedaotao/handler", new VQWEB.administrator.handlers.hn_HedaotaoHandler()));
            routes.Add("Admin_Quiz_Handler", new Route("admin/huongnghiep/quiz/handler", new VQWEB.administrator.handlers.hn_QuizHandler()));
            routes.Add("Admin_Tinhthanh_Handler", new Route("admin/huongnghiep/tinhthanh/handler", new VQWEB.administrator.handlers.hn_TinhthanhHandler()));
            routes.Add("Admin_Diem_Handler", new Route("admin/huongnghiep/diem/handler", new VQWEB.administrator.handlers.hn_DiemHandler()));
            routes.Add("Admin_Doanhnghiep_Handler", new Route("admin/huongnghiep/doanhnghiep/handler", new VQWEB.administrator.handlers.hn_DoanhnghiepHandler()));
            
            //Front-End
            routes.Add("Front_News_Handler", new Route("news/handler", new VQWEB.huongnghiep.handlers.NewsHandler()));
            routes.Add("Front_Profession_Handler", new Route("pro/handler", new VQWEB.huongnghiep.handlers.ProfessionHanler()));
            routes.Add("Front_Quiz_Handler", new Route("quiz/handler", new VQWEB.huongnghiep.handlers.QuizHandler()));
        }


        protected void Application_Error(object sender, EventArgs e)
        {           
            
        }
        
    }
}